/*
 * Copyright (c) 2014. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * http://www.apache.org/licenses/LICENSE-2.0
 */

package com.dc.gameserver.serverCore.service.battle.coreBattleLogic;

import com.google.protobuf.MessageLite;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.PooledByteBufAllocator;

import javax.annotation.PostConstruct;

/**
 * @author 石头哥哥</br>
 *         Project : gameServer1.1</br>
 *         Date: 13-11-2  11</br>
 *         Time: 下午4:46</br>
 *         Connect: 13638363871@163.com</br>
 *         packageName: Server.ServerCore.Service.fightProcess</br>
 *         注解：
 */
public abstract  class AbstractSoulLogic implements ISoul {


    /**
     *  实例化处理单个玩家出牌逻辑引用
     */
    @PostConstruct
    public abstract void PostConstruct();

    public  ByteBuf wrappedBufferShort(int ID, MessageLite messageLite) {
        ByteBuf buffer= PooledByteBufAllocator.DEFAULT.heapBuffer(0x40);
        buffer.setIndex(0,0x2);//设定writeIndex指针位置
        buffer.writeInt(ID); //编号
        if (messageLite!=null)buffer.writeBytes(messageLite.toByteArray());
        buffer.setShort(0,buffer.writerIndex()- 0x2);
        messageLite=null;
        return buffer;
    }

}
